package com.lxj.word.controller;

import com.lxj.utils.common.CommonResult;
import com.lxj.utils.entity.Word;
import com.lxj.word.service.WordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/word")
public class WordController {
    @Autowired
    private WordService wordService;
    @PostMapping("/findAll")
    public CommonResult findAll(Word word){
        return wordService.findAll(word);
    }
    @PostMapping("/like")
    public CommonResult like(Integer id ,String username){
        return wordService.like(id,username);
    }
    @PostMapping("/collect")
    public CommonResult collect(Integer id,String username){
        return wordService.collect(id,username);
    }
    @PostMapping("/findLike")
    public CommonResult findLike(String username){
        return wordService.findLike(username);
    }
    @PostMapping("/findCollect")
    public  CommonResult findCollect(String username){
        return wordService.findCollect(username);
    }
    @PostMapping("/myCollect")
    public CommonResult myCollect(Word word){
        return wordService.myCollect(word);
    }
    @PostMapping("/cancelCollect")
    public CommonResult cancelCollect(Integer id,String username){
        return wordService.cancelCollect(id,username);
    }
    @PostMapping("/mySubmit")
    public CommonResult mySubmit(Word word){
        return wordService.mySubmit(word);
    }
    @PostMapping("/add")
    public CommonResult add(Word word){
        return wordService.add(word);
    }
    @PostMapping("/findById")
    public CommonResult findById(Integer id){
        return wordService.findById(id);
    }
    @PostMapping("/delete")
    public CommonResult delete(Integer[] id){
        return wordService.delete(id);
    }
    @PostMapping("/edit")
    public CommonResult edit(Word word){
        return wordService.edit(word);
    }
}
